package com.sparkflow.mysqlbinlog.clickhousesync.config.properties;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * MySQL Binlog配置属性类
 * 管理MySQL Binlog连接参数和同步表配置
 *
 * @author Mr_xiaoZH
 * @date 2025-07-23
 */
@Getter
@Setter
@Component
@ConfigurationProperties(prefix = "mysql.binlog")
public class MysqlBinlogProperties implements Serializable {

    private String host;
    private int port;
    private String username;
    private String password;
    private long serverId;
    private List<String> syncTables;

    private Connection connection = new Connection();

    @Getter
    @Setter
    public static class Connection {
        private int connectTimeout = 3000;
        private int socketTimeout = 60000;
        private int heartbeatInterval = 60000;
        private boolean keepAlive = true;
    }

    public List<String> getSyncTables() {
        return syncTables == null ? new ArrayList<>() : syncTables;
    }
}